package com.wg.msproductgz.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wg.msproductgz.entity.ProductspecValue;
import com.wg.msproductgz.service.ProductspecValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class ProductspecValueController {
    @Autowired
    private ProductspecValueService productspecValueService;
    @PostMapping("/product/ProductspecValue")
    public int insert(@RequestBody ProductspecValue ProductspecValue){
        Boolean result = productspecValueService.save(ProductspecValue);
        return result ? 1 : 0;
    }
    @GetMapping("/product/ProductspecValue/{specId}")
    public ProductspecValue select(@PathVariable Integer specId){
        return productspecValueService.getById(specId);
    }

    @PostMapping("/product/ProductspecValue/select")
    public List<ProductspecValue> select(@RequestBody(required = false) ProductspecValue ProductspecValue){
        return productspecValueService.select(ProductspecValue);
    }
    @DeleteMapping("/product/ProductspecValue/{specId}")
    public int delete(@PathVariable Integer specId){
        Boolean result = productspecValueService.removeById(specId);
        return result ? 1 : 0;
    }
    @PutMapping("ProductspecValue")
    public int update(@RequestBody ProductspecValue ProductspecValue){
        Boolean result = productspecValueService.updateById(ProductspecValue);
        return result ? 1 : 0;
    }
}
